<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Eigen: Eigen::SelfAdjointEigenSolver&lt; MatrixType_ &gt; Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(function() { init_search(); });
/* @license-end */
</script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="eigendoxy.css" rel="stylesheet" type="text/css">
<!--  -->
<script type="text/javascript" src="eigen_navtree_hacks.js"></script>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="Eigen_Silly_Professor_64x64.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname"><a href="http://eigen.tuxfamily.org">Eigen</a>
   &#160;<span id="projectnumber">3.4.90 (git rev 67eeba6e720c5745abc77ae6c92ce0a44aa7b7ae)</span>
   </div>
  </td>
   <td>        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.svg"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
          </span>
        </div>
</td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('classEigen_1_1SelfAdjointEigenSolver.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="classEigen_1_1SelfAdjointEigenSolver-members.html">List of all members</a> &#124;
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-attribs">Static Public Attributes</a>  </div>
  <div class="headertitle">
<div class="title">Eigen::SelfAdjointEigenSolver&lt; MatrixType_ &gt; Class Template Reference<div class="ingroups"><a class="el" href="group__DenseLinearSolvers__chapter.html">Dense linear problems and decompositions</a> &raquo; <a class="el" href="group__DenseLinearSolvers__Reference.html">Reference</a> &raquo; <a class="el" href="group__Eigenvalues__Module.html">Eigenvalues module</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><h3>template&lt;typename MatrixType_&gt;<br />
class Eigen::SelfAdjointEigenSolver&lt; MatrixType_ &gt;</h3>

<p>Computes eigenvalues and eigenvectors of selfadjoint matrices. </p>
<p>This is defined in the Eigenvalues module.</p><div class="fragment"><div class="line"><span class="preprocessor">#include &lt;Eigen/Eigenvalues&gt;</span> </div>
</div><!-- fragment --><dl class="tparams"><dt>Template Parameters</dt><dd>
  <table class="tparams">
    <tr><td class="paramname">MatrixType_</td><td>the type of the matrix of which we are computing the eigendecomposition; this is expected to be an instantiation of the <a class="el" href="classEigen_1_1Matrix.html" title="The matrix class, also used for vectors and row-vectors.">Matrix</a> class template.</td></tr>
  </table>
  </dd>
</dl>
<p>A matrix \( A \) is selfadjoint if it equals its adjoint. For real matrices, this means that the matrix is symmetric: it equals its transpose. This class computes the eigenvalues and eigenvectors of a selfadjoint matrix. These are the scalars \( \lambda \) and vectors \( v \) such that \( Av = \lambda v \). The eigenvalues of a selfadjoint matrix are always real. If \( D \) is a diagonal matrix with the eigenvalues on the diagonal, and \( V \) is a matrix with the eigenvectors as its columns, then \( A = V D V^{-1} \). This is called the eigendecomposition.</p>
<p>For a selfadjoint matrix, \( V \) is unitary, meaning its inverse is equal to its adjoint, \( V^{-1} = V^{\dagger} \). If \( A \) is real, then \( V \) is also real and therefore orthogonal, meaning its inverse is equal to its transpose, \( V^{-1} = V^T \).</p>
<p>The algorithm exploits the fact that the matrix is selfadjoint, making it faster and more accurate than the general purpose eigenvalue algorithms implemented in <a class="el" href="classEigen_1_1EigenSolver.html" title="Computes eigenvalues and eigenvectors of general matrices.">EigenSolver</a> and <a class="el" href="classEigen_1_1ComplexEigenSolver.html" title="Computes eigenvalues and eigenvectors of general complex matrices.">ComplexEigenSolver</a>.</p>
<p>Only the <b>lower</b> <b>triangular</b> <b>part</b> of the input matrix is referenced.</p>
<p>Call the function <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a62817de3e0cbf009a02c7ece6a0e3d64" title="Computes eigendecomposition of given matrix.">compute()</a> to compute the eigenvalues and eigenvectors of a given matrix. Alternatively, you can use the SelfAdjointEigenSolver(const MatrixType&amp;, int) constructor which computes the eigenvalues and eigenvectors at construction time. Once the eigenvalue and eigenvectors are computed, they can be retrieved with the <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#aaf4ed4172a517a4b9f0ab222f629e261" title="Returns the eigenvalues of given matrix.">eigenvalues()</a> and <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a837627aecb3ba7ed40a2e1bfa3806d08" title="Returns the eigenvectors of given matrix.">eigenvectors()</a> functions.</p>
<p>The documentation for SelfAdjointEigenSolver(const MatrixType&amp;, int) contains an example of the typical use of this class.</p>
<p>To solve the <em>generalized</em> eigenvalue problem \( Av = \lambda Bv \) and the likes, see the class <a class="el" href="classEigen_1_1GeneralizedSelfAdjointEigenSolver.html" title="Computes eigenvalues and eigenvectors of the generalized selfadjoint eigen problem.">GeneralizedSelfAdjointEigenSolver</a>.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classEigen_1_1MatrixBase.html#a30430fa3d5b4e74d312fd4f502ac984d" title="Computes the eigenvalues of a matrix.">MatrixBase::eigenvalues()</a>, class <a class="el" href="classEigen_1_1EigenSolver.html" title="Computes eigenvalues and eigenvectors of general matrices.">EigenSolver</a>, class <a class="el" href="classEigen_1_1ComplexEigenSolver.html" title="Computes eigenvalues and eigenvectors of general complex matrices.">ComplexEigenSolver</a> </dd></dl>
</div><div id="dynsection-0" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
  <img id="dynsection-0-trigger" src="closed.png" alt="+"/> Inheritance diagram for Eigen::SelfAdjointEigenSolver&lt; MatrixType_ &gt;:</div>
<div id="dynsection-0-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-0-content" class="dyncontent" style="display:none;">
<div class="center"><img src="classEigen_1_1SelfAdjointEigenSolver__inherit__graph.png" border="0" usemap="#aEigen_1_1SelfAdjointEigenSolver_3_01MatrixType___01_4_inherit__map" alt="Inheritance graph"/></div>
<map name="aEigen_1_1SelfAdjointEigenSolver_3_01MatrixType___01_4_inherit__map" id="aEigen_1_1SelfAdjointEigenSolver_3_01MatrixType___01_4_inherit__map">
<area shape="rect" title="Computes eigenvalues and eigenvectors of selfadjoint matrices." alt="" coords="7,5,203,361"/>
<area shape="rect" href="classEigen_1_1GeneralizedSelfAdjointEigenSolver.html" title="Computes eigenvalues and eigenvectors of the generalized selfadjoint eigen problem." alt="" coords="5,409,204,589"/>
</map>
</div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:a7c52c334cec08ff33425e4b3f5474eb8"><td class="memItemLeft" align="right" valign="top">typedef <a class="el" href="namespaceEigen.html#a62e77e0933482dafde8fe197d9a2cfde">Eigen::Index</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a7c52c334cec08ff33425e4b3f5474eb8">Index</a></td></tr>
<tr class="separator:a7c52c334cec08ff33425e4b3f5474eb8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a346d14d83fcf669a85810209b758feae"><td class="memItemLeft" align="right" valign="top">typedef <a class="el" href="structEigen_1_1NumTraits.html">NumTraits</a>&lt; <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a846b7e7de3b117ffcf4226d04ecec77b">Scalar</a> &gt;::Real&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a346d14d83fcf669a85810209b758feae">RealScalar</a></td></tr>
<tr class="memdesc:a346d14d83fcf669a85810209b758feae"><td class="mdescLeft">&#160;</td><td class="mdescRight">Real scalar type for <code>MatrixType_</code>.  <a href="classEigen_1_1SelfAdjointEigenSolver.html#a346d14d83fcf669a85810209b758feae">More...</a><br /></td></tr>
<tr class="separator:a346d14d83fcf669a85810209b758feae"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0fc5528f6a59753d3003907f3a88548f"><td class="memItemLeft" align="right" valign="top">typedef internal::plain_col_type&lt; MatrixType, <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a346d14d83fcf669a85810209b758feae">RealScalar</a> &gt;::type&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a0fc5528f6a59753d3003907f3a88548f">RealVectorType</a></td></tr>
<tr class="memdesc:a0fc5528f6a59753d3003907f3a88548f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Type for vector of eigenvalues as returned by <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#aaf4ed4172a517a4b9f0ab222f629e261" title="Returns the eigenvalues of given matrix.">eigenvalues()</a>.  <a href="classEigen_1_1SelfAdjointEigenSolver.html#a0fc5528f6a59753d3003907f3a88548f">More...</a><br /></td></tr>
<tr class="separator:a0fc5528f6a59753d3003907f3a88548f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a846b7e7de3b117ffcf4226d04ecec77b"><td class="memItemLeft" align="right" valign="top"><a id="a846b7e7de3b117ffcf4226d04ecec77b"></a>
typedef MatrixType::Scalar&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a846b7e7de3b117ffcf4226d04ecec77b">Scalar</a></td></tr>
<tr class="memdesc:a846b7e7de3b117ffcf4226d04ecec77b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Scalar type for matrices of type <code>MatrixType_</code>. <br /></td></tr>
<tr class="separator:a846b7e7de3b117ffcf4226d04ecec77b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a62817de3e0cbf009a02c7ece6a0e3d64"><td class="memTemplParams" colspan="2">template&lt;typename InputType &gt; </td></tr>
<tr class="memitem:a62817de3e0cbf009a02c7ece6a0e3d64"><td class="memTemplItemLeft" align="right" valign="top"><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html">SelfAdjointEigenSolver</a> &amp;&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a62817de3e0cbf009a02c7ece6a0e3d64">compute</a> (const <a class="el" href="structEigen_1_1EigenBase.html">EigenBase</a>&lt; InputType &gt; &amp;matrix, int options=<a class="el" href="group__enums.html#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4">ComputeEigenvectors</a>)</td></tr>
<tr class="memdesc:a62817de3e0cbf009a02c7ece6a0e3d64"><td class="mdescLeft">&#160;</td><td class="mdescRight">Computes eigendecomposition of given matrix.  <a href="classEigen_1_1SelfAdjointEigenSolver.html#a62817de3e0cbf009a02c7ece6a0e3d64">More...</a><br /></td></tr>
<tr class="separator:a62817de3e0cbf009a02c7ece6a0e3d64"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afe520161701f5f585bcc4cedb8657bd1"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html">SelfAdjointEigenSolver</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#afe520161701f5f585bcc4cedb8657bd1">computeDirect</a> (const MatrixType &amp;matrix, int options=<a class="el" href="group__enums.html#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4">ComputeEigenvectors</a>)</td></tr>
<tr class="memdesc:afe520161701f5f585bcc4cedb8657bd1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Computes eigendecomposition of given matrix using a closed-form algorithm.  <a href="classEigen_1_1SelfAdjointEigenSolver.html#afe520161701f5f585bcc4cedb8657bd1">More...</a><br /></td></tr>
<tr class="separator:afe520161701f5f585bcc4cedb8657bd1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a297893df7098c43278d385e4d4e23fe4"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html">SelfAdjointEigenSolver</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a297893df7098c43278d385e4d4e23fe4">computeFromTridiagonal</a> (const <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a0fc5528f6a59753d3003907f3a88548f">RealVectorType</a> &amp;diag, const <a class="el" href="classEigen_1_1Matrix.html">SubDiagonalType</a> &amp;subdiag, int options=<a class="el" href="group__enums.html#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4">ComputeEigenvectors</a>)</td></tr>
<tr class="memdesc:a297893df7098c43278d385e4d4e23fe4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Computes the eigen decomposition from a tridiagonal symmetric matrix.  <a href="classEigen_1_1SelfAdjointEigenSolver.html#a297893df7098c43278d385e4d4e23fe4">More...</a><br /></td></tr>
<tr class="separator:a297893df7098c43278d385e4d4e23fe4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aaf4ed4172a517a4b9f0ab222f629e261"><td class="memItemLeft" align="right" valign="top">const <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a0fc5528f6a59753d3003907f3a88548f">RealVectorType</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#aaf4ed4172a517a4b9f0ab222f629e261">eigenvalues</a> () const</td></tr>
<tr class="memdesc:aaf4ed4172a517a4b9f0ab222f629e261"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the eigenvalues of given matrix.  <a href="classEigen_1_1SelfAdjointEigenSolver.html#aaf4ed4172a517a4b9f0ab222f629e261">More...</a><br /></td></tr>
<tr class="separator:aaf4ed4172a517a4b9f0ab222f629e261"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a837627aecb3ba7ed40a2e1bfa3806d08"><td class="memItemLeft" align="right" valign="top">const <a class="el" href="classEigen_1_1Matrix.html">EigenvectorsType</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a837627aecb3ba7ed40a2e1bfa3806d08">eigenvectors</a> () const</td></tr>
<tr class="memdesc:a837627aecb3ba7ed40a2e1bfa3806d08"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the eigenvectors of given matrix.  <a href="classEigen_1_1SelfAdjointEigenSolver.html#a837627aecb3ba7ed40a2e1bfa3806d08">More...</a><br /></td></tr>
<tr class="separator:a837627aecb3ba7ed40a2e1bfa3806d08"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a61de3180668fc0439251d832ebfe6b27"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__enums.html#ga85fad7b87587764e5cf6b513a9e0ee5e">ComputationInfo</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a61de3180668fc0439251d832ebfe6b27">info</a> () const</td></tr>
<tr class="memdesc:a61de3180668fc0439251d832ebfe6b27"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reports whether previous computation was successful.  <a href="classEigen_1_1SelfAdjointEigenSolver.html#a61de3180668fc0439251d832ebfe6b27">More...</a><br /></td></tr>
<tr class="separator:a61de3180668fc0439251d832ebfe6b27"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4b3ddd941804994eaeede8cb65698bfd"><td class="memItemLeft" align="right" valign="top">MatrixType&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a4b3ddd941804994eaeede8cb65698bfd">operatorInverseSqrt</a> () const</td></tr>
<tr class="memdesc:a4b3ddd941804994eaeede8cb65698bfd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Computes the inverse square root of the matrix.  <a href="classEigen_1_1SelfAdjointEigenSolver.html#a4b3ddd941804994eaeede8cb65698bfd">More...</a><br /></td></tr>
<tr class="separator:a4b3ddd941804994eaeede8cb65698bfd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a86020f7dece7dc114c8696af5617c792"><td class="memItemLeft" align="right" valign="top">MatrixType&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a86020f7dece7dc114c8696af5617c792">operatorSqrt</a> () const</td></tr>
<tr class="memdesc:a86020f7dece7dc114c8696af5617c792"><td class="mdescLeft">&#160;</td><td class="mdescRight">Computes the positive-definite square root of the matrix.  <a href="classEigen_1_1SelfAdjointEigenSolver.html#a86020f7dece7dc114c8696af5617c792">More...</a><br /></td></tr>
<tr class="separator:a86020f7dece7dc114c8696af5617c792"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a57b9403646ff5ee26b86e3821c08e729"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a57b9403646ff5ee26b86e3821c08e729">SelfAdjointEigenSolver</a> ()</td></tr>
<tr class="memdesc:a57b9403646ff5ee26b86e3821c08e729"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default constructor for fixed-size matrices.  <a href="classEigen_1_1SelfAdjointEigenSolver.html#a57b9403646ff5ee26b86e3821c08e729">More...</a><br /></td></tr>
<tr class="separator:a57b9403646ff5ee26b86e3821c08e729"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af9cf17478ced5a7d5b8391bb10873fac"><td class="memTemplParams" colspan="2">template&lt;typename InputType &gt; </td></tr>
<tr class="memitem:af9cf17478ced5a7d5b8391bb10873fac"><td class="memTemplItemLeft" align="right" valign="top">&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#af9cf17478ced5a7d5b8391bb10873fac">SelfAdjointEigenSolver</a> (const <a class="el" href="structEigen_1_1EigenBase.html">EigenBase</a>&lt; InputType &gt; &amp;matrix, int options=<a class="el" href="group__enums.html#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4">ComputeEigenvectors</a>)</td></tr>
<tr class="memdesc:af9cf17478ced5a7d5b8391bb10873fac"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor; computes eigendecomposition of given matrix.  <a href="classEigen_1_1SelfAdjointEigenSolver.html#af9cf17478ced5a7d5b8391bb10873fac">More...</a><br /></td></tr>
<tr class="separator:af9cf17478ced5a7d5b8391bb10873fac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac7a97741f1db4b17f7a00211667db5e2"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#ac7a97741f1db4b17f7a00211667db5e2">SelfAdjointEigenSolver</a> (<a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a7c52c334cec08ff33425e4b3f5474eb8">Index</a> size)</td></tr>
<tr class="memdesc:ac7a97741f1db4b17f7a00211667db5e2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor, pre-allocates memory for dynamic-size matrices.  <a href="classEigen_1_1SelfAdjointEigenSolver.html#ac7a97741f1db4b17f7a00211667db5e2">More...</a><br /></td></tr>
<tr class="separator:ac7a97741f1db4b17f7a00211667db5e2"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-attribs"></a>
Static Public Attributes</h2></td></tr>
<tr class="memitem:aefe08bf9db5a3ff94a241c56fe6e2870"><td class="memItemLeft" align="right" valign="top">static const int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#aefe08bf9db5a3ff94a241c56fe6e2870">m_maxIterations</a></td></tr>
<tr class="memdesc:aefe08bf9db5a3ff94a241c56fe6e2870"><td class="mdescLeft">&#160;</td><td class="mdescRight">Maximum number of iterations.  <a href="classEigen_1_1SelfAdjointEigenSolver.html#aefe08bf9db5a3ff94a241c56fe6e2870">More...</a><br /></td></tr>
<tr class="separator:aefe08bf9db5a3ff94a241c56fe6e2870"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Member Typedef Documentation</h2>
<a id="a7c52c334cec08ff33425e4b3f5474eb8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7c52c334cec08ff33425e4b3f5474eb8">&#9670;&nbsp;</a></span>Index</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename MatrixType_ &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">typedef <a class="el" href="namespaceEigen.html#a62e77e0933482dafde8fe197d9a2cfde">Eigen::Index</a> <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html">Eigen::SelfAdjointEigenSolver</a>&lt; MatrixType_ &gt;::<a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a7c52c334cec08ff33425e4b3f5474eb8">Index</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000019">Deprecated:</a></b></dt><dd>since <a class="el" href="namespaceEigen.html" title="Namespace containing all symbols from the Eigen library.">Eigen</a> 3.3 </dd></dl>

</div>
</div>
<a id="a346d14d83fcf669a85810209b758feae"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a346d14d83fcf669a85810209b758feae">&#9670;&nbsp;</a></span>RealScalar</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename MatrixType_ &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">typedef <a class="el" href="structEigen_1_1NumTraits.html">NumTraits</a>&lt;<a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a846b7e7de3b117ffcf4226d04ecec77b">Scalar</a>&gt;::Real <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html">Eigen::SelfAdjointEigenSolver</a>&lt; MatrixType_ &gt;::<a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a346d14d83fcf669a85810209b758feae">RealScalar</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Real scalar type for <code>MatrixType_</code>. </p>
<p>This is just <code>Scalar</code> if <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a846b7e7de3b117ffcf4226d04ecec77b" title="Scalar type for matrices of type MatrixType_.">Scalar</a> is real (e.g., <code>float</code> or <code>double</code>), and the type of the real part of <code>Scalar</code> if <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a846b7e7de3b117ffcf4226d04ecec77b" title="Scalar type for matrices of type MatrixType_.">Scalar</a> is complex. </p>

</div>
</div>
<a id="a0fc5528f6a59753d3003907f3a88548f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0fc5528f6a59753d3003907f3a88548f">&#9670;&nbsp;</a></span>RealVectorType</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename MatrixType_ &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">typedef internal::plain_col_type&lt;MatrixType, <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a346d14d83fcf669a85810209b758feae">RealScalar</a>&gt;::type <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html">Eigen::SelfAdjointEigenSolver</a>&lt; MatrixType_ &gt;::<a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a0fc5528f6a59753d3003907f3a88548f">RealVectorType</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Type for vector of eigenvalues as returned by <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#aaf4ed4172a517a4b9f0ab222f629e261" title="Returns the eigenvalues of given matrix.">eigenvalues()</a>. </p>
<p>This is a column vector with entries of type <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a346d14d83fcf669a85810209b758feae" title="Real scalar type for MatrixType_.">RealScalar</a>. The length of the vector is the size of <code>MatrixType_</code>. </p>

</div>
</div>
<h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a57b9403646ff5ee26b86e3821c08e729"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a57b9403646ff5ee26b86e3821c08e729">&#9670;&nbsp;</a></span>SelfAdjointEigenSolver() <span class="overload">[1/3]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename MatrixType_ &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html">Eigen::SelfAdjointEigenSolver</a>&lt; MatrixType_ &gt;::<a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html">SelfAdjointEigenSolver</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Default constructor for fixed-size matrices. </p>
<p>The default constructor is useful in cases in which the user intends to perform decompositions via <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a62817de3e0cbf009a02c7ece6a0e3d64" title="Computes eigendecomposition of given matrix.">compute()</a>. This constructor can only be used if <code>MatrixType_</code> is a fixed-size matrix; use <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#ac7a97741f1db4b17f7a00211667db5e2" title="Constructor, pre-allocates memory for dynamic-size matrices.">SelfAdjointEigenSolver(Index)</a> for dynamic-size matrices.</p>
<p>Example: </p><div class="fragment"><div class="line">SelfAdjointEigenSolver&lt;Matrix4f&gt; es;</div>
<div class="line"><a class="code" href="group__matrixtypedefs.html#ga3a5de8dfef28d29aed525611e15a37e3">Matrix4f</a> X = <a class="code" href="classEigen_1_1DenseBase.html#ae814abb451b48ed872819192dc188c19">Matrix4f::Random</a>(4,4);</div>
<div class="line"><a class="code" href="group__matrixtypedefs.html#ga3a5de8dfef28d29aed525611e15a37e3">Matrix4f</a> A = X + X.transpose();</div>
<div class="line">es.compute(A);</div>
<div class="line">cout &lt;&lt; <span class="stringliteral">&quot;The eigenvalues of A are: &quot;</span> &lt;&lt; es.eigenvalues().transpose() &lt;&lt; endl;</div>
<div class="line">es.compute(A + <a class="code" href="classEigen_1_1MatrixBase.html#a98bb9a0f705c6dfde85b0bfff31bf88f">Matrix4f::Identity</a>(4,4)); <span class="comment">// re-use es to compute eigenvalues of A+I</span></div>
<div class="line">cout &lt;&lt; <span class="stringliteral">&quot;The eigenvalues of A+I are: &quot;</span> &lt;&lt; es.eigenvalues().transpose() &lt;&lt; endl;</div>
<div class="ttc" id="aclassEigen_1_1DenseBase_html_ae814abb451b48ed872819192dc188c19"><div class="ttname"><a href="classEigen_1_1DenseBase.html#ae814abb451b48ed872819192dc188c19">Eigen::DenseBase::Random</a></div><div class="ttdeci">static const RandomReturnType Random()</div><div class="ttdef"><b>Definition:</b> Random.h:114</div></div>
<div class="ttc" id="aclassEigen_1_1MatrixBase_html_a98bb9a0f705c6dfde85b0bfff31bf88f"><div class="ttname"><a href="classEigen_1_1MatrixBase.html#a98bb9a0f705c6dfde85b0bfff31bf88f">Eigen::MatrixBase::Identity</a></div><div class="ttdeci">static const IdentityReturnType Identity()</div><div class="ttdef"><b>Definition:</b> CwiseNullaryOp.h:801</div></div>
<div class="ttc" id="agroup__matrixtypedefs_html_ga3a5de8dfef28d29aed525611e15a37e3"><div class="ttname"><a href="group__matrixtypedefs.html#ga3a5de8dfef28d29aed525611e15a37e3">Eigen::Matrix4f</a></div><div class="ttdeci">Matrix&lt; float, 4, 4 &gt; Matrix4f</div><div class="ttdoc">4×4 matrix of type float.</div><div class="ttdef"><b>Definition:</b> Matrix.h:500</div></div>
</div><!-- fragment --><p> Output: </p><pre class="fragment">The eigenvalues of A are:  -1.58 -0.473   1.32   2.46
The eigenvalues of A+I are: -0.581  0.527   2.32   3.46
</pre> 
</div>
</div>
<a id="ac7a97741f1db4b17f7a00211667db5e2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac7a97741f1db4b17f7a00211667db5e2">&#9670;&nbsp;</a></span>SelfAdjointEigenSolver() <span class="overload">[2/3]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename MatrixType_ &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html">Eigen::SelfAdjointEigenSolver</a>&lt; MatrixType_ &gt;::<a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html">SelfAdjointEigenSolver</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a7c52c334cec08ff33425e4b3f5474eb8">Index</a>&#160;</td>
          <td class="paramname"><em>size</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">explicit</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Constructor, pre-allocates memory for dynamic-size matrices. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">size</td><td>Positive integer, size of the matrix whose eigenvalues and eigenvectors will be computed.</td></tr>
  </table>
  </dd>
</dl>
<p>This constructor is useful for dynamic-size matrices, when the user intends to perform decompositions via <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a62817de3e0cbf009a02c7ece6a0e3d64" title="Computes eigendecomposition of given matrix.">compute()</a>. The <code>size</code> parameter is only used as a hint. It is not an error to give a wrong <code>size</code>, but it may impair performance.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a62817de3e0cbf009a02c7ece6a0e3d64" title="Computes eigendecomposition of given matrix.">compute()</a> for an example </dd></dl>

</div>
</div>
<a id="af9cf17478ced5a7d5b8391bb10873fac"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af9cf17478ced5a7d5b8391bb10873fac">&#9670;&nbsp;</a></span>SelfAdjointEigenSolver() <span class="overload">[3/3]</span></h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename MatrixType_ &gt; </div>
<div class="memtemplate">
template&lt;typename InputType &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html">Eigen::SelfAdjointEigenSolver</a>&lt; MatrixType_ &gt;::<a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html">SelfAdjointEigenSolver</a> </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structEigen_1_1EigenBase.html">EigenBase</a>&lt; InputType &gt; &amp;&#160;</td>
          <td class="paramname"><em>matrix</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>options</em> = <code><a class="el" href="group__enums.html#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4">ComputeEigenvectors</a></code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">explicit</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Constructor; computes eigendecomposition of given matrix. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">matrix</td><td>Selfadjoint matrix whose eigendecomposition is to be computed. Only the lower triangular part of the matrix is referenced. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">options</td><td>Can be <a class="el" href="group__enums.html#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4">ComputeEigenvectors</a> (default) or <a class="el" href="group__enums.html#ggae3e239fb70022eb8747994cf5d68b4a9afd06633f270207c373875fd7ca03e906">EigenvaluesOnly</a>.</td></tr>
  </table>
  </dd>
</dl>
<p>This constructor calls compute(const MatrixType&amp;, int) to compute the eigenvalues of the matrix <code>matrix</code>. The eigenvectors are computed if <code>options</code> equals <a class="el" href="group__enums.html#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4">ComputeEigenvectors</a>.</p>
<p>Example: </p><div class="fragment"><div class="line"><a class="code" href="group__matrixtypedefs.html#ga99b41a69f0bf64eadb63a97f357ab412">MatrixXd</a> X = <a class="code" href="classEigen_1_1DenseBase.html#ae814abb451b48ed872819192dc188c19">MatrixXd::Random</a>(5,5);</div>
<div class="line"><a class="code" href="group__matrixtypedefs.html#ga99b41a69f0bf64eadb63a97f357ab412">MatrixXd</a> A = X + X.transpose();</div>
<div class="line">cout &lt;&lt; <span class="stringliteral">&quot;Here is a random symmetric 5x5 matrix, A:&quot;</span> &lt;&lt; endl &lt;&lt; A &lt;&lt; endl &lt;&lt; endl;</div>
<div class="line"> </div>
<div class="line">SelfAdjointEigenSolver&lt;MatrixXd&gt; es(A);</div>
<div class="line">cout &lt;&lt; <span class="stringliteral">&quot;The eigenvalues of A are:&quot;</span> &lt;&lt; endl &lt;&lt; es.eigenvalues() &lt;&lt; endl;</div>
<div class="line">cout &lt;&lt; <span class="stringliteral">&quot;The matrix of eigenvectors, V, is:&quot;</span> &lt;&lt; endl &lt;&lt; es.eigenvectors() &lt;&lt; endl &lt;&lt; endl;</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">double</span> lambda = es.eigenvalues()[0];</div>
<div class="line">cout &lt;&lt; <span class="stringliteral">&quot;Consider the first eigenvalue, lambda = &quot;</span> &lt;&lt; lambda &lt;&lt; endl;</div>
<div class="line"><a class="code" href="group__matrixtypedefs.html#ga8554c6170729f01c7572574837ecf618">VectorXd</a> v = es.eigenvectors().col(0);</div>
<div class="line">cout &lt;&lt; <span class="stringliteral">&quot;If v is the corresponding eigenvector, then lambda * v = &quot;</span> &lt;&lt; endl &lt;&lt; lambda * v &lt;&lt; endl;</div>
<div class="line">cout &lt;&lt; <span class="stringliteral">&quot;... and A * v = &quot;</span> &lt;&lt; endl &lt;&lt; A * v &lt;&lt; endl &lt;&lt; endl;</div>
<div class="line"> </div>
<div class="line"><a class="code" href="group__matrixtypedefs.html#ga99b41a69f0bf64eadb63a97f357ab412">MatrixXd</a> D = es.eigenvalues().asDiagonal();</div>
<div class="line"><a class="code" href="group__matrixtypedefs.html#ga99b41a69f0bf64eadb63a97f357ab412">MatrixXd</a> V = es.eigenvectors();</div>
<div class="line">cout &lt;&lt; <span class="stringliteral">&quot;Finally, V * D * V^(-1) = &quot;</span> &lt;&lt; endl &lt;&lt; V * D * V.inverse() &lt;&lt; endl;</div>
<div class="ttc" id="agroup__matrixtypedefs_html_ga8554c6170729f01c7572574837ecf618"><div class="ttname"><a href="group__matrixtypedefs.html#ga8554c6170729f01c7572574837ecf618">Eigen::VectorXd</a></div><div class="ttdeci">Matrix&lt; double, Dynamic, 1 &gt; VectorXd</div><div class="ttdoc">Dynamic×1 vector of type double.</div><div class="ttdef"><b>Definition:</b> Matrix.h:501</div></div>
<div class="ttc" id="agroup__matrixtypedefs_html_ga99b41a69f0bf64eadb63a97f357ab412"><div class="ttname"><a href="group__matrixtypedefs.html#ga99b41a69f0bf64eadb63a97f357ab412">Eigen::MatrixXd</a></div><div class="ttdeci">Matrix&lt; double, Dynamic, Dynamic &gt; MatrixXd</div><div class="ttdoc">Dynamic×Dynamic matrix of type double.</div><div class="ttdef"><b>Definition:</b> Matrix.h:501</div></div>
</div><!-- fragment --><p> Output: </p><pre class="fragment">Here is a random symmetric 5x5 matrix, A:
  1.36 -0.816  0.521   1.43 -0.144
-0.816 -0.659  0.794 -0.173 -0.406
 0.521  0.794 -0.541  0.461  0.179
  1.43 -0.173  0.461  -1.43  0.822
-0.144 -0.406  0.179  0.822  -1.37

The eigenvalues of A are:
 -2.65
 -1.77
-0.745
 0.227
  2.29
The matrix of eigenvectors, V, is:
 -0.326 -0.0984   0.347 -0.0109   0.874
 -0.207  -0.642   0.228   0.662  -0.232
 0.0495   0.629  -0.164    0.74   0.164
  0.721  -0.397  -0.402   0.115   0.385
 -0.573  -0.156  -0.799 -0.0256  0.0858

Consider the first eigenvalue, lambda = -2.65
If v is the corresponding eigenvector, then lambda * v = 
 0.865
  0.55
-0.131
 -1.91
  1.52
... and A * v = 
 0.865
  0.55
-0.131
 -1.91
  1.52

Finally, V * D * V^(-1) = 
  1.36 -0.816  0.521   1.43 -0.144
-0.816 -0.659  0.794 -0.173 -0.406
 0.521  0.794 -0.541  0.461  0.179
  1.43 -0.173  0.461  -1.43  0.822
-0.144 -0.406  0.179  0.822  -1.37
</pre><dl class="section see"><dt>See also</dt><dd>compute(const MatrixType&amp;, int) </dd></dl>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a62817de3e0cbf009a02c7ece6a0e3d64"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a62817de3e0cbf009a02c7ece6a0e3d64">&#9670;&nbsp;</a></span>compute()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename MatrixType_ &gt; </div>
<div class="memtemplate">
template&lt;typename InputType &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html">SelfAdjointEigenSolver</a>&amp; <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html">Eigen::SelfAdjointEigenSolver</a>&lt; MatrixType_ &gt;::compute </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structEigen_1_1EigenBase.html">EigenBase</a>&lt; InputType &gt; &amp;&#160;</td>
          <td class="paramname"><em>matrix</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>options</em> = <code><a class="el" href="group__enums.html#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4">ComputeEigenvectors</a></code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Computes eigendecomposition of given matrix. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">matrix</td><td>Selfadjoint matrix whose eigendecomposition is to be computed. Only the lower triangular part of the matrix is referenced. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">options</td><td>Can be <a class="el" href="group__enums.html#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4">ComputeEigenvectors</a> (default) or <a class="el" href="group__enums.html#ggae3e239fb70022eb8747994cf5d68b4a9afd06633f270207c373875fd7ca03e906">EigenvaluesOnly</a>. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Reference to <code>*this</code> </dd></dl>
<p>This function computes the eigenvalues of <code>matrix</code>. The <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#aaf4ed4172a517a4b9f0ab222f629e261" title="Returns the eigenvalues of given matrix.">eigenvalues()</a> function can be used to retrieve them. If <code>options</code> equals <a class="el" href="group__enums.html#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4">ComputeEigenvectors</a>, then the eigenvectors are also computed and can be retrieved by calling <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a837627aecb3ba7ed40a2e1bfa3806d08" title="Returns the eigenvectors of given matrix.">eigenvectors()</a>.</p>
<p>This implementation uses a symmetric QR algorithm. The matrix is first reduced to tridiagonal form using the <a class="el" href="classEigen_1_1Tridiagonalization.html" title="Tridiagonal decomposition of a selfadjoint matrix.">Tridiagonalization</a> class. The tridiagonal matrix is then brought to diagonal form with implicit symmetric QR steps with Wilkinson shift. Details can be found in Section 8.3 of Golub &amp; Van Loan, <em>Matrix Computations</em>.</p>
<p>The cost of the computation is about \( 9n^3 \) if the eigenvectors are required and \( 4n^3/3 \) if they are not required.</p>
<p>This method reuses the memory in the <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html" title="Computes eigenvalues and eigenvectors of selfadjoint matrices.">SelfAdjointEigenSolver</a> object that was allocated when the object was constructed, if the size of the matrix does not change.</p>
<p>Example: </p><div class="fragment"><div class="line">SelfAdjointEigenSolver&lt;MatrixXf&gt; es(4);</div>
<div class="line"><a class="code" href="group__matrixtypedefs.html#ga731599f782380312960376c43450eb48">MatrixXf</a> X = <a class="code" href="classEigen_1_1DenseBase.html#ae814abb451b48ed872819192dc188c19">MatrixXf::Random</a>(4,4);</div>
<div class="line"><a class="code" href="group__matrixtypedefs.html#ga731599f782380312960376c43450eb48">MatrixXf</a> A = X + X.transpose();</div>
<div class="line">es.compute(A);</div>
<div class="line">cout &lt;&lt; <span class="stringliteral">&quot;The eigenvalues of A are: &quot;</span> &lt;&lt; es.eigenvalues().transpose() &lt;&lt; endl;</div>
<div class="line">es.compute(A + <a class="code" href="classEigen_1_1MatrixBase.html#a98bb9a0f705c6dfde85b0bfff31bf88f">MatrixXf::Identity</a>(4,4)); <span class="comment">// re-use es to compute eigenvalues of A+I</span></div>
<div class="line">cout &lt;&lt; <span class="stringliteral">&quot;The eigenvalues of A+I are: &quot;</span> &lt;&lt; es.eigenvalues().transpose() &lt;&lt; endl;</div>
<div class="ttc" id="agroup__matrixtypedefs_html_ga731599f782380312960376c43450eb48"><div class="ttname"><a href="group__matrixtypedefs.html#ga731599f782380312960376c43450eb48">Eigen::MatrixXf</a></div><div class="ttdeci">Matrix&lt; float, Dynamic, Dynamic &gt; MatrixXf</div><div class="ttdoc">Dynamic×Dynamic matrix of type float.</div><div class="ttdef"><b>Definition:</b> Matrix.h:500</div></div>
</div><!-- fragment --><p> Output: </p><pre class="fragment">The eigenvalues of A are:  -1.58 -0.473   1.32   2.46
The eigenvalues of A+I are: -0.581  0.527   2.32   3.46
</pre><dl class="section see"><dt>See also</dt><dd>SelfAdjointEigenSolver(const MatrixType&amp;, int) </dd></dl>

</div>
</div>
<a id="afe520161701f5f585bcc4cedb8657bd1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afe520161701f5f585bcc4cedb8657bd1">&#9670;&nbsp;</a></span>computeDirect()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename MatrixType &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html">SelfAdjointEigenSolver</a>&lt; MatrixType &gt; &amp; <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html">Eigen::SelfAdjointEigenSolver</a>&lt; MatrixType &gt;::computeDirect </td>
          <td>(</td>
          <td class="paramtype">const MatrixType &amp;&#160;</td>
          <td class="paramname"><em>matrix</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>options</em> = <code><a class="el" href="group__enums.html#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4">ComputeEigenvectors</a></code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Computes eigendecomposition of given matrix using a closed-form algorithm. </p>
<p>This is a variant of compute(const MatrixType&amp;, int options) which directly solves the underlying polynomial equation.</p>
<p>Currently only 2x2 and 3x3 matrices for which the sizes are known at compile time are supported (e.g., Matrix3d).</p>
<p>This method is usually significantly faster than the QR iterative algorithm but it might also be less accurate. It is also worth noting that for 3x3 matrices it involves trigonometric operations which are not necessarily available for all scalar types.</p>
<p>For the 3x3 case, we observed the following worst case relative error regarding the eigenvalues:</p><ul>
<li>double: 1e-8</li>
<li>float: 1e-3</li>
</ul>
<dl class="section see"><dt>See also</dt><dd>compute(const MatrixType&amp;, int options) </dd></dl>

</div>
</div>
<a id="a297893df7098c43278d385e4d4e23fe4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a297893df7098c43278d385e4d4e23fe4">&#9670;&nbsp;</a></span>computeFromTridiagonal()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename MatrixType &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html">SelfAdjointEigenSolver</a>&lt; MatrixType &gt; &amp; <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html">Eigen::SelfAdjointEigenSolver</a>&lt; MatrixType &gt;::computeFromTridiagonal </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a0fc5528f6a59753d3003907f3a88548f">RealVectorType</a> &amp;&#160;</td>
          <td class="paramname"><em>diag</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="classEigen_1_1Matrix.html">SubDiagonalType</a> &amp;&#160;</td>
          <td class="paramname"><em>subdiag</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>options</em> = <code><a class="el" href="group__enums.html#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4">ComputeEigenvectors</a></code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Computes the eigen decomposition from a tridiagonal symmetric matrix. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">diag</td><td>The vector containing the diagonal of the matrix. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">subdiag</td><td>The subdiagonal of the matrix. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">options</td><td>Can be <a class="el" href="group__enums.html#ggae3e239fb70022eb8747994cf5d68b4a9a7f7d17fba3c9bb92158e346d5979d0f4">ComputeEigenvectors</a> (default) or <a class="el" href="group__enums.html#ggae3e239fb70022eb8747994cf5d68b4a9afd06633f270207c373875fd7ca03e906">EigenvaluesOnly</a>. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Reference to <code>*this</code> </dd></dl>
<p>This function assumes that the matrix has been reduced to tridiagonal form.</p>
<dl class="section see"><dt>See also</dt><dd>compute(const MatrixType&amp;, int) for more information </dd></dl>

</div>
</div>
<a id="aaf4ed4172a517a4b9f0ab222f629e261"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aaf4ed4172a517a4b9f0ab222f629e261">&#9670;&nbsp;</a></span>eigenvalues()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename MatrixType_ &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">const <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a0fc5528f6a59753d3003907f3a88548f">RealVectorType</a>&amp; <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html">Eigen::SelfAdjointEigenSolver</a>&lt; MatrixType_ &gt;::eigenvalues </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Returns the eigenvalues of given matrix. </p>
<dl class="section return"><dt>Returns</dt><dd>A const reference to the column vector containing the eigenvalues.</dd></dl>
<dl class="section pre"><dt>Precondition</dt><dd>The eigenvalues have been computed before.</dd></dl>
<p>The eigenvalues are repeated according to their algebraic multiplicity, so there are as many eigenvalues as rows in the matrix. The eigenvalues are sorted in increasing order.</p>
<p>Example: </p><div class="fragment"><div class="line"><a class="code" href="group__matrixtypedefs.html#ga99b41a69f0bf64eadb63a97f357ab412">MatrixXd</a> ones = <a class="code" href="classEigen_1_1DenseBase.html#a2755cb4023f7376880523626a8e05101">MatrixXd::Ones</a>(3,3);</div>
<div class="line">SelfAdjointEigenSolver&lt;MatrixXd&gt; es(ones);</div>
<div class="line">cout &lt;&lt; <span class="stringliteral">&quot;The eigenvalues of the 3x3 matrix of ones are:&quot;</span> </div>
<div class="line">     &lt;&lt; endl &lt;&lt; es.eigenvalues() &lt;&lt; endl;</div>
<div class="ttc" id="aclassEigen_1_1DenseBase_html_a2755cb4023f7376880523626a8e05101"><div class="ttname"><a href="classEigen_1_1DenseBase.html#a2755cb4023f7376880523626a8e05101">Eigen::DenseBase::Ones</a></div><div class="ttdeci">static const ConstantReturnType Ones()</div><div class="ttdef"><b>Definition:</b> CwiseNullaryOp.h:672</div></div>
</div><!-- fragment --><p> Output: </p><pre class="fragment">The eigenvalues of the 3x3 matrix of ones are:
-3.09e-16
        0
        3
</pre><dl class="section see"><dt>See also</dt><dd><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a837627aecb3ba7ed40a2e1bfa3806d08" title="Returns the eigenvectors of given matrix.">eigenvectors()</a>, <a class="el" href="classEigen_1_1MatrixBase.html#a30430fa3d5b4e74d312fd4f502ac984d" title="Computes the eigenvalues of a matrix.">MatrixBase::eigenvalues()</a> </dd></dl>

</div>
</div>
<a id="a837627aecb3ba7ed40a2e1bfa3806d08"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a837627aecb3ba7ed40a2e1bfa3806d08">&#9670;&nbsp;</a></span>eigenvectors()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename MatrixType_ &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">const <a class="el" href="classEigen_1_1Matrix.html">EigenvectorsType</a>&amp; <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html">Eigen::SelfAdjointEigenSolver</a>&lt; MatrixType_ &gt;::eigenvectors </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Returns the eigenvectors of given matrix. </p>
<dl class="section return"><dt>Returns</dt><dd>A const reference to the matrix whose columns are the eigenvectors.</dd></dl>
<dl class="section pre"><dt>Precondition</dt><dd>The eigenvectors have been computed before.</dd></dl>
<p>Column \( k \) of the returned matrix is an eigenvector corresponding to eigenvalue number \( k \) as returned by <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#aaf4ed4172a517a4b9f0ab222f629e261" title="Returns the eigenvalues of given matrix.">eigenvalues()</a>. The eigenvectors are normalized to have (Euclidean) norm equal to one. If this object was used to solve the eigenproblem for the selfadjoint matrix \( A \), then the matrix returned by this function is the matrix \( V \) in the eigendecomposition \( A = V D V^{-1} \).</p>
<p>For a selfadjoint matrix, \( V \) is unitary, meaning its inverse is equal to its adjoint, \( V^{-1} = V^{\dagger} \). If \( A \) is real, then \( V \) is also real and therefore orthogonal, meaning its inverse is equal to its transpose, \( V^{-1} = V^T \).</p>
<p>Example: </p><div class="fragment"><div class="line"><a class="code" href="group__matrixtypedefs.html#ga99b41a69f0bf64eadb63a97f357ab412">MatrixXd</a> ones = <a class="code" href="classEigen_1_1DenseBase.html#a2755cb4023f7376880523626a8e05101">MatrixXd::Ones</a>(3,3);</div>
<div class="line">SelfAdjointEigenSolver&lt;MatrixXd&gt; es(ones);</div>
<div class="line">cout &lt;&lt; <span class="stringliteral">&quot;The first eigenvector of the 3x3 matrix of ones is:&quot;</span> </div>
<div class="line">     &lt;&lt; endl &lt;&lt; es.eigenvectors().col(0) &lt;&lt; endl;</div>
</div><!-- fragment --><p> Output: </p><pre class="fragment">The first eigenvector of the 3x3 matrix of ones is:
-0.816
 0.408
 0.408
</pre><dl class="section see"><dt>See also</dt><dd><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#aaf4ed4172a517a4b9f0ab222f629e261" title="Returns the eigenvalues of given matrix.">eigenvalues()</a> </dd></dl>

</div>
</div>
<a id="a61de3180668fc0439251d832ebfe6b27"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a61de3180668fc0439251d832ebfe6b27">&#9670;&nbsp;</a></span>info()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename MatrixType_ &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__enums.html#ga85fad7b87587764e5cf6b513a9e0ee5e">ComputationInfo</a> <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html">Eigen::SelfAdjointEigenSolver</a>&lt; MatrixType_ &gt;::info </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Reports whether previous computation was successful. </p>
<dl class="section return"><dt>Returns</dt><dd><code>Success</code> if computation was successful, <code>NoConvergence</code> otherwise. </dd></dl>

</div>
</div>
<a id="a4b3ddd941804994eaeede8cb65698bfd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4b3ddd941804994eaeede8cb65698bfd">&#9670;&nbsp;</a></span>operatorInverseSqrt()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename MatrixType_ &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">MatrixType <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html">Eigen::SelfAdjointEigenSolver</a>&lt; MatrixType_ &gt;::operatorInverseSqrt </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Computes the inverse square root of the matrix. </p>
<dl class="section return"><dt>Returns</dt><dd>the inverse positive-definite square root of the matrix</dd></dl>
<dl class="section pre"><dt>Precondition</dt><dd>The eigenvalues and eigenvectors of a positive-definite matrix have been computed before.</dd></dl>
<p>This function uses the eigendecomposition \( A = V D V^{-1} \) to compute the inverse square root as \( V D^{-1/2} V^{-1} \). This is cheaper than first computing the square root with <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a86020f7dece7dc114c8696af5617c792" title="Computes the positive-definite square root of the matrix.">operatorSqrt()</a> and then its inverse with <a class="el" href="classEigen_1_1MatrixBase.html#a7712eb69e8ea3c8f7b8da1c44dbdeebf">MatrixBase::inverse()</a>.</p>
<p>Example: </p><div class="fragment"><div class="line"><a class="code" href="group__matrixtypedefs.html#ga99b41a69f0bf64eadb63a97f357ab412">MatrixXd</a> X = <a class="code" href="classEigen_1_1DenseBase.html#ae814abb451b48ed872819192dc188c19">MatrixXd::Random</a>(4,4);</div>
<div class="line"><a class="code" href="group__matrixtypedefs.html#ga99b41a69f0bf64eadb63a97f357ab412">MatrixXd</a> A = X * X.transpose();</div>
<div class="line">cout &lt;&lt; <span class="stringliteral">&quot;Here is a random positive-definite matrix, A:&quot;</span> &lt;&lt; endl &lt;&lt; A &lt;&lt; endl &lt;&lt; endl;</div>
<div class="line"> </div>
<div class="line">SelfAdjointEigenSolver&lt;MatrixXd&gt; es(A);</div>
<div class="line">cout &lt;&lt; <span class="stringliteral">&quot;The inverse square root of A is: &quot;</span> &lt;&lt; endl;</div>
<div class="line">cout &lt;&lt; es.operatorInverseSqrt() &lt;&lt; endl;</div>
<div class="line">cout &lt;&lt; <span class="stringliteral">&quot;We can also compute it with operatorSqrt() and inverse(). That yields: &quot;</span> &lt;&lt; endl;</div>
<div class="line">cout &lt;&lt; es.operatorSqrt().inverse() &lt;&lt; endl;</div>
</div><!-- fragment --><p> Output: </p><pre class="fragment">Here is a random positive-definite matrix, A:
  1.41 -0.697 -0.111  0.508
-0.697  0.423 0.0991   -0.4
-0.111 0.0991   1.25  0.902
 0.508   -0.4  0.902    1.4

The inverse square root of A is: 
  1.88   2.78 -0.546  0.605
  2.78   8.61   -2.3   2.74
-0.546   -2.3   1.92  -1.36
 0.605   2.74  -1.36   2.18
We can also compute it with operatorSqrt() and inverse(). That yields: 
  1.88   2.78 -0.546  0.605
  2.78   8.61   -2.3   2.74
-0.546   -2.3   1.92  -1.36
 0.605   2.74  -1.36   2.18
</pre><dl class="section see"><dt>See also</dt><dd><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a86020f7dece7dc114c8696af5617c792" title="Computes the positive-definite square root of the matrix.">operatorSqrt()</a>, <a class="el" href="classEigen_1_1MatrixBase.html#a7712eb69e8ea3c8f7b8da1c44dbdeebf">MatrixBase::inverse()</a>, <a href="unsupported/group__MatrixFunctions__Module.html">MatrixFunctions Module</a> </dd></dl>

</div>
</div>
<a id="a86020f7dece7dc114c8696af5617c792"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a86020f7dece7dc114c8696af5617c792">&#9670;&nbsp;</a></span>operatorSqrt()</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename MatrixType_ &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">MatrixType <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html">Eigen::SelfAdjointEigenSolver</a>&lt; MatrixType_ &gt;::operatorSqrt </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Computes the positive-definite square root of the matrix. </p>
<dl class="section return"><dt>Returns</dt><dd>the positive-definite square root of the matrix</dd></dl>
<dl class="section pre"><dt>Precondition</dt><dd>The eigenvalues and eigenvectors of a positive-definite matrix have been computed before.</dd></dl>
<p>The square root of a positive-definite matrix \( A \) is the positive-definite matrix whose square equals \( A \). This function uses the eigendecomposition \( A = V D V^{-1} \) to compute the square root as \( A^{1/2} = V D^{1/2} V^{-1} \).</p>
<p>Example: </p><div class="fragment"><div class="line"><a class="code" href="group__matrixtypedefs.html#ga99b41a69f0bf64eadb63a97f357ab412">MatrixXd</a> X = <a class="code" href="classEigen_1_1DenseBase.html#ae814abb451b48ed872819192dc188c19">MatrixXd::Random</a>(4,4);</div>
<div class="line"><a class="code" href="group__matrixtypedefs.html#ga99b41a69f0bf64eadb63a97f357ab412">MatrixXd</a> A = X * X.transpose();</div>
<div class="line">cout &lt;&lt; <span class="stringliteral">&quot;Here is a random positive-definite matrix, A:&quot;</span> &lt;&lt; endl &lt;&lt; A &lt;&lt; endl &lt;&lt; endl;</div>
<div class="line"> </div>
<div class="line">SelfAdjointEigenSolver&lt;MatrixXd&gt; es(A);</div>
<div class="line"><a class="code" href="group__matrixtypedefs.html#ga99b41a69f0bf64eadb63a97f357ab412">MatrixXd</a> sqrtA = es.operatorSqrt();</div>
<div class="line">cout &lt;&lt; <span class="stringliteral">&quot;The square root of A is: &quot;</span> &lt;&lt; endl &lt;&lt; sqrtA &lt;&lt; endl;</div>
<div class="line">cout &lt;&lt; <span class="stringliteral">&quot;If we square this, we get: &quot;</span> &lt;&lt; endl &lt;&lt; sqrtA*sqrtA &lt;&lt; endl;</div>
</div><!-- fragment --><p> Output: </p><pre class="fragment">Here is a random positive-definite matrix, A:
  1.41 -0.697 -0.111  0.508
-0.697  0.423 0.0991   -0.4
-0.111 0.0991   1.25  0.902
 0.508   -0.4  0.902    1.4

The square root of A is: 
   1.09  -0.432 -0.0685     0.2
 -0.432   0.379   0.141  -0.269
-0.0685   0.141       1   0.468
    0.2  -0.269   0.468    1.04
If we square this, we get: 
  1.41 -0.697 -0.111  0.508
-0.697  0.423 0.0991   -0.4
-0.111 0.0991   1.25  0.902
 0.508   -0.4  0.902    1.4
</pre><dl class="section see"><dt>See also</dt><dd><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html#a4b3ddd941804994eaeede8cb65698bfd" title="Computes the inverse square root of the matrix.">operatorInverseSqrt()</a>, <a href="unsupported/group__MatrixFunctions__Module.html">MatrixFunctions Module</a> </dd></dl>

</div>
</div>
<h2 class="groupheader">Member Data Documentation</h2>
<a id="aefe08bf9db5a3ff94a241c56fe6e2870"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aefe08bf9db5a3ff94a241c56fe6e2870">&#9670;&nbsp;</a></span>m_maxIterations</h2>

<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename MatrixType_ &gt; </div>
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">const int <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html">Eigen::SelfAdjointEigenSolver</a>&lt; MatrixType_ &gt;::m_maxIterations</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Maximum number of iterations. </p>
<p>The algorithm terminates if it does not converge within m_maxIterations * n iterations, where n denotes the size of the matrix. This value is currently set to 30 (copied from LAPACK). </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="SelfAdjointEigenSolver_8h_source.html">SelfAdjointEigenSolver.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="namespaceEigen.html">Eigen</a></li><li class="navelem"><a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html">SelfAdjointEigenSolver</a></li>
    <li class="footer">Generated on Thu Apr 21 2022 13:07:56 for Eigen by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.9.1 </li>
  </ul>
</div>
</body>
</html>
